﻿using UnityEngine;
using System.Collections;

public class SoundManager : MonoBehaviour {

	public static SoundManager Instance = null;
	private AudioSource soundEffectAudio;

	//clips
	public AudioClip gunFire;
	public AudioClip upgradedGunFire;
	public AudioClip hurt;
	public AudioClip alienDeath;
	public AudioClip marineDeath;
	public AudioClip victory;
	public AudioClip elevatorArrived;
	public AudioClip powerUpPickup;
	public AudioClip powerUpAppear;

	// Use this for initialization
	void Start () {
		if (Instance == null) {
			Instance = this;
		} else if (Instance != this) {
			Destroy (gameObject);
		} 

		AudioSource[] sources = GetComponents<AudioSource> ();
		foreach(AudioSource audio in sources) {
			if (audio.clip == null) {
				soundEffectAudio = audio;
				break;
			}
		}
	}

	public void PlayOneShot(AudioClip clip) {
		soundEffectAudio.PlayOneShot (clip);
	}
}
